package net.zrnecko.km.entity;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Logger;

import net.zrnecko.km.client.PersistenceService;

import org.apache.commons.fileupload.FileItem;

import com.google.inject.Inject;

public class DataFileProcessorImpl implements DataFileProcessor {
	
	@Inject
	private Logger log;
	
	@Inject
	private PersistenceService ps;
	
	private File file;
	
	/* (non-Javadoc)
	 * @see net.zrnecko.km.entity.DataFileProcessor#process(java.lang.String, java.io.File)
	 */
	public void process(String fileType, FileItem fileItem) {
		try {
			log.info("Starting data file processing...");
			BufferedReader file = new BufferedReader(new InputStreamReader(fileItem.getInputStream()));
			String line = file.readLine();
			while (line != null) {
				log.info("Fetched line: " + line);
				line = file.readLine();
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
			
	}

}
